home *** CD-ROM | disk | FTP | other *** search
/ Aminet 2 / Aminet AMIGA CDROM (1994)(Walnut Creek)[Feb 1994][W.O. 44790-1].iso / Aminet / util / misc / Fudgit233.lha / Source / examples / fac.ft < prev    next >
Encoding:
Text File  |  1993-12-14  |  310 b   |  18 lines

  1. # Print factorial of numbers from 0 to 120.
  2. cmode
  3.     func fac(x) {  # This `x' is a prototype: it does not exist.
  4.         if (x <= 0)  {
  5.            return(1)
  6.         } else {
  7.            return(x * fac(--x))
  8.         }
  9.     }
  10.     {
  11.            auto x=1  # This `x' is a local scalar variable
  12.            while (x<=120) {
  13.                x, " : ", fac(x++)
  14.         }
  15.    }
  16. fmode
  17.  
  18.